<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>模板字面量标签函数加上剩余操作符</title>
</head>

<body>
  <script>
    let a = 6;
    let b = 9;

    function simpleTag(strings, ...expressions) {
      console.log(strings);
      expressions.forEach(expression => console.log(expression));

      return 'foobar';
    }

    let taggedResult = simpleTag`${a} + ${b} = ${a + b}`;
    // ["", " + ", " = ", ""]
    // 6
    // 9
    // 15

    console.log(taggedResult);  // "foobar"

    console.log(`\u00A9`);  // ©
    console.log(String.raw`\u00A9`);  //  \u00A9

    console.log(`first line\nsecond line`);
    // first line
    // second line
    console.log(String.raw`first line\nsecode line`);  // first line\nsecode line

    console.log(String.raw`first line
second line`);
    // first line
    // second line
  </script>
</body>

</html>